import request from '@/utils/request'

const baseUrl = ""
const accountPath = "account/"
const projectPath = "project/"
const projectGenHisPath = "projectGenHis/"

export function login(data) {
  return request({url: baseUrl + 'login', method: 'post', data})
}

export function logout() {
  return request({url: baseUrl + 'logout', method: 'post'})
}
export function testDb(data) {
  return request({url: baseUrl + 'test/db', method: 'post', data: data})
}
export function testRedis(data) {
  return request({url: baseUrl + 'test/redis', method: 'post', data: data})
}

/******** 用户 *********/
/***** 账号 *******/
export function accountInfo() {
  return request({url: baseUrl + accountPath + 'info', method: 'get'})
}
export function saveAccount(data) {
  return request({url: baseUrl + accountPath + 'save', method: 'post', data: data})
}
export function accounts(parameter) {
  return request({url: baseUrl + accountPath + 'accounts',  method: 'get', params: parameter})
}
export function updateAccountStatus(id, op) {
  return request({url: baseUrl + accountPath + op + '/' + id, method: 'post'})
}
export function delAccount(id) {
  return request({url: baseUrl + accountPath + 'del/' + id, method: 'post'})
}
export function delAccountBatch(ids) {
  return request({url: baseUrl + accountPath + 'delBatch', method: 'post', data: ids})
}

/******** Project *********/
export function saveProject(data) {
  return request({url: baseUrl + projectPath + 'save', method: 'post', data: data})
}

export function delProject(id) {
  return request({url: baseUrl + projectPath + 'del/' + id, method: 'post'})
}

export function genProject(id) {
  return request({url: baseUrl + projectPath + 'gen/' + id, method: 'post'})
}

export function delProjectBatch(ids) {
  return request({url: baseUrl + projectPath + 'delBatch', method: 'post', data: ids})
}

export function getProject() {
  return request({url: baseUrl + projectPath + 'project/' + id, method: 'get'})
}

export function projects(parameter) {
  return request({url: baseUrl + projectPath + 'projects', method: 'get', params: parameter})
}

export function projectList(parameter) {
  return request({url: baseUrl + projectPath + 'projectList', method: 'get', params: parameter})
}

/******** Project 生成记录 *********/
export function projectGenHis(parameter) {
  return request({url: baseUrl + projectGenHisPath + 'projectHiss', method: 'get', params: parameter})
}
